package priv.yiyuan.example.design.proxy;

/**
 * 实际文件操作实现
 * <p>
 * 装饰器模式-具体组件/代理模式-真实主题
 *
 * @author YiYuan
 * @data 2025/9/25
 * @apoNote
 */
public class RealFileOperation implements FileOperation {

    private String fileContent = "";

    @Override
    public void write(String filePath, String content) {

        System.out.println("\n[真实文件操作] 正在将内容写入文件: " + filePath);
        this.fileContent = content;
        System.out.println("写入成功, 文件内容为: " + content);

    }

    @Override
    public String read(String filePath) {

        System.out.println("\n[真实文件操作] 正在从文件读取内容: " + filePath);
        System.out.println("读取成功, 文件内容为: " + fileContent);

        return fileContent;
    }
}
